import request from '@/utils/request'

// 封装获取简单员工列表的模块
export const getEmploeeSimple = () => request({
  url: '/sys/user/simple'
})

// 获取员工列表
export const getEmploeeList = (params) => request({
  url: '/sys/user',
  params
})

// 删除员工列表
export const delEmployee = (id) => request({
  url: `/sys/user/${id}`,
  method: 'delete'
})

// 导入员工接口
export const importEmployee = (data) => request({
  url: '/sys/user/batch',
  method: 'post',
  data
})

// 新增员工接口
export const addEmployee = (data) => request({
  url: '/sys/user',
  method: 'post',
  data
})

// 保存员工基本信息
export const savaUserDetail = (data) => request({
  url: `/sys/user/${data.id}`,
  method: 'put',
  data
})

// 获取员工个人信息的读取
export const getPersonalDetail = (id) => request({
  url: `/employees/${id}/personalInfo`
})

// 编辑员工个人信息并保存
export const updatePersonal = (data) => request({
  url: `/employees/${data.id}/personalInfo`,
  method: 'put',
  data
})

// 获取用户的岗位信息
export const getJobDetail = (id) => request({
  url: `/employees/${id}/jobs`
})

// 编辑用户的岗位信息
export const updateJob = (data) => request({
  url: `/employees/${data.userId}/jobs`,
  method: 'put',
  data
})

// 设置员工角色
export const assignRole = (data) => request({
  url: '/sys/user/assignRoles',
  method: 'put',
  data
})
